//
//  LSZAudioZuoErCollectionViewCell.m
//  JKFuYinProject
//
//  Created by 九酷 on 2018/4/13.
//  Copyright © 2018年 LC. All rights reserved.
//

#import "LSZAudioZuoErCollectionViewCell.h"

@implementation LSZAudioZuoErCollectionViewCell
-(id)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        UIView * viewLow = [[UIView alloc]init];
        viewLow.backgroundColor = [UIColor whiteColor];
        [viewLow bringSubviewToFront:self.imageViewIcon];
        [self insertSubview:viewLow atIndex:0];

        self.imageViewIcon = [[UIImageView alloc] init];
        [self.imageViewIcon.layer setMasksToBounds:YES];
        [self.imageViewIcon.layer setCornerRadius:4];
        [self.imageViewIcon.layer setBorderWidth:0.3];
        self.imageViewIcon.contentMode = UIViewContentModeScaleAspectFill;
        [self.imageViewIcon.layer setBorderColor:RGBColor(237, 237, 237).CGColor];
        [viewLow insertSubview:self.imageViewIcon atIndex:1];

        self.imageViewErJi = [[UIImageView alloc]init];
        self.imageViewErJi.image = [UIImage imageNamed:@"白耳机"];
        [self.imageViewIcon addSubview:self.imageViewErJi];

        self.labelClick = [[UILabel alloc]init];
        self.labelClick.textColor = [UIColor whiteColor];
        [self.imageViewIcon addSubview:self.labelClick];

        self.labelTotal = [[UILabel alloc]init];
        self.labelTotal.textColor = [UIColor whiteColor];
        [LSZSpecialPackaging setLabelAdaptiveSize:self.labelTotal font:12.5];
        [self.imageViewIcon addSubview:self.labelTotal];

        UIImageView * imageViewPlay = [[UIImageView alloc]init];
        imageViewPlay.image = [UIImage imageNamed:@"播放器-播放"];
        [self.imageViewIcon addSubview:imageViewPlay];

        self.titleLabel = [[UILabel alloc] init];
        self.titleLabel.textColor = titleColorLSZ;
        [LSZSpecialPackaging setLabel_14_5_Size:self.titleLabel];
        [self addSubview:self.titleLabel];
        [self.titleLabel sizeToFit];
        [viewLow mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self).offset(0);
            make.right.equalTo(self).offset(0);
            make.left.equalTo(self).offset(0);
            make.bottom.equalTo(self.mas_bottom).offset(0);
        }];
        [self.imageViewIcon mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.mas_top).offset(0);
            make.left.equalTo(self.mas_left);
            make.right.equalTo(self.mas_right);
            make.height.equalTo(self.imageViewIcon.mas_width);
        }];

        [self.labelClick mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.offset(20);
            make.height.offset(15);
            make.right.equalTo(self.mas_right).offset(-2);
            make.top.equalTo(self.imageViewIcon.mas_top).offset(5);
        }];

        [self.imageViewErJi mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.offset(15);
            make.height.offset(15);
            make.right.equalTo(self.labelClick.mas_left).offset(-2);
            make.top.equalTo(self.imageViewIcon.mas_top).offset(5);
        }];


        [self.labelTotal mas_makeConstraints:^(MASConstraintMaker *make) {
            make.height.offset(15);
            make.left.equalTo(self.mas_left).offset(10);
            make.right.equalTo(self.mas_right).offset(-30);
            make.bottom.equalTo(self.imageViewIcon.mas_bottom).offset(-5);
        }];

        [imageViewPlay mas_makeConstraints:^(MASConstraintMaker *make) {
            make.width.offset(20);
            make.height.offset(20);
            make.right.equalTo(self.mas_right).offset(-10);
            make.bottom.equalTo(self.imageViewIcon.mas_bottom).offset(-5);
        }];

        [self.titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(self.imageViewIcon.mas_bottom).offset(10);
            make.right.equalTo(self).offset(0);
            make.left.equalTo(self).offset(0);
            make.height.offset(15);
        }];
    }
    return self;
}
 
@end
